/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidades.Revision;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Roggers
 */
@Entity
@Table(name = "versionarticulo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Versionarticulo.findAll", query = "SELECT v FROM Versionarticulo v"),
    @NamedQuery(name = "Versionarticulo.findByIdVersionArticulo", query = "SELECT v FROM Versionarticulo v WHERE v.idVersionArticulo = :idVersionArticulo"),
    @NamedQuery(name = "Versionarticulo.findByVersion", query = "SELECT v FROM Versionarticulo v WHERE v.version = :version")})
public class Versionarticulo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "IdVersionArticulo", nullable = false)
    private Integer idVersionArticulo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "version", nullable = false, length = 10)
    private String version;
    @JoinColumn(name = "IdArticulo", referencedColumnName = "IdArticulo", nullable = false)
    @ManyToOne(optional = false)
    private Articulo idArticulo;

    public Versionarticulo() {
    }

    public Versionarticulo(Integer idVersionArticulo) {
        this.idVersionArticulo = idVersionArticulo;
    }

    public Versionarticulo(Integer idVersionArticulo, String version) {
        this.idVersionArticulo = idVersionArticulo;
        this.version = version;
    }

    public Integer getIdVersionArticulo() {
        return idVersionArticulo;
    }

    public void setIdVersionArticulo(Integer idVersionArticulo) {
        this.idVersionArticulo = idVersionArticulo;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public Articulo getIdArticulo() {
        return idArticulo;
    }

    public void setIdArticulo(Articulo idArticulo) {
        this.idArticulo = idArticulo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idVersionArticulo != null ? idVersionArticulo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Versionarticulo)) {
            return false;
        }
        Versionarticulo other = (Versionarticulo) object;
        if ((this.idVersionArticulo == null && other.idVersionArticulo != null) || (this.idVersionArticulo != null && !this.idVersionArticulo.equals(other.idVersionArticulo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Revision.Versionarticulo[ idVersionArticulo=" + idVersionArticulo + " ]";
    }
    
}
